package com.neucollege.system.config;

import com.neucollege.system.interceptor.NEPGInterceptor;
import com.neucollege.system.interceptor.NEPMInterceptor;
import com.neucollege.system.interceptor.NEPSInterceptor;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@RequiredArgsConstructor
public class JWTConfig implements WebMvcConfigurer {

    private final NEPSInterceptor nepsInterceptor;
    private final NEPMInterceptor nepmInterceptor;
    private final NEPGInterceptor nepgInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(nepsInterceptor)
                .addPathPatterns("/neps/**")
                .excludePathPatterns("/neps/login","/neps/register");
        registry.addInterceptor(nepmInterceptor)
                .addPathPatterns("/nepm/**")
                .excludePathPatterns("/nepm/login");
        registry.addInterceptor(nepgInterceptor)
                .addPathPatterns("/nepg/**")
                .excludePathPatterns("/nepg/login");
        WebMvcConfigurer.super.addInterceptors(registry);
    }
}
